function [ neighbors ] = getNeighbors( image, pixel)
%UNTITLED3 Summary of this function goes here
%   Detailed explanation goes here

        %Create a mask of the neighbors with a 1 where each neighbor is
        neighRows = [pixel(1,1)-1: pixel(1,1)+1];
        neighCols = [pixel(1,2)-1 :pixel(1,2)+1];
        neighborhood = image(neighRows,neighCols);
        neighborhood(2,2) = 0;
       
        %If there is a one in the matrix find its displacement from the
        %center and sav eit in an nx2  subscript matrix.
        [row,col] = find(neighborhood);
        displacement = [row-2,col-2];
        numNeighbors = size(displacement,1);
        neighbors =  displacement+repmat(pixel,[numNeighbors , 1]);
       
end

